import {
  q as i,
  p as T,
  ap as _,
  X as W,
  f as O,
  H,
  av as w,
  aw as j,
  k as a,
  m as l,
  l as s,
  az as q,
  as as o,
  aG as G,
  at as y
} from "./index-30f27935.js";
import { f as B } from "./finance-301595de.js";
function Y(C) {
  const c = i([]),
    r = i(!0);
  i({}), T();
  const v = i(1),
    f = i(10),
    x = i({}),
    b = i({}),
    E = _("reload"),
    h = W({
      pageSize: 10,
      currentPage: 1,
      pageSizes: [10, 20, 30],
      total: 0,
      align: "right",
      background: !0,
      small: !1
    }),
    S = W({
      text: "正在加载第一页...",
      viewBox: "-10, -10, 50, 50",
      spinner: `
        <path class="path" d="
          M 30 15
          L 28 17
          M 25.61 25.61
          A 15 15, 0, 0, 1, 15 30
          A 15 15, 0, 1, 1, 27.99 7.5
          L 15 15
        " style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>
      `
    }),
    D = [
      {
        type: "selection",
        width: 55,
        align: "left",
        hide: ({ checkList: e }) => !e.includes("勾选列")
      },
      {
        label: "序号",
        type: "index",
        width: 70,
        hide: ({ checkList: e }) => !e.includes("序号列")
      },
      { label: "ID", prop: "id", minWidth: 50 },
      { label: "手机号", prop: "user_phone", minWidth: 100 },
      {
        label: "持卡人",
        prop: "bank_user",
        minWidth: 80,
        formatter: ({ bank_user: e }) =>
          e ||
          a(
            s("el-tag"),
            { class: "mx-1", type: "info", effect: "light" },
            { default: () => [l("暂无")] }
          )
      },
      {
        label: "证件号",
        prop: "card_code",
        minWidth: 180,
        formatter: ({ card_code: e }) =>
          e ||
          a(
            s("el-tag"),
            { class: "mx-1", type: "info", effect: "light" },
            { default: () => [l("暂无")] }
          )
      },
      {
        label: "银行名称",
        prop: "bank_name",
        minWidth: 150,
        formatter: ({ bank_content: e, bank_name: t }) =>
          (e == null ? void 0 : e.split(",").length) == 2
            ? e.split(",")[0]
            : t ||
              a(
                s("el-tag"),
                { class: "mx-1", type: "info", effect: "light" },
                { default: () => [l("暂无")] }
              )
      },
      {
        label: "银行卡号",
        prop: "bank_content",
        minWidth: 150,
        formatter: ({ bank_content: e, bank_code: t }) =>
          (e == null ? void 0 : e.split(",").length) == 2
            ? e.split(",")[1]
            : t ||
              a(
                s("el-tag"),
                { class: "mx-1", type: "info", effect: "light" },
                { default: () => [l("暂无")] }
              )
      },
      {
        label: "支付宝账号",
        prop: "ali_code",
        minWidth: 120,
        formatter: ({ ali_code: e }) =>
          e ||
          a(
            s("el-tag"),
            { class: "mx-1", type: "info", effect: "light" },
            { default: () => [l("暂无")] }
          )
      },
      {
        label: "支付宝名称",
        prop: "ali_name",
        minWidth: 80,
        formatter: ({ ali_name: e }) =>
          e ||
          a(
            s("el-tag"),
            { class: "mx-1", type: "info", effect: "light" },
            { default: () => [l("暂无")] }
          )
      },
      { label: "提现金额", prop: "cash_money", minWidth: 80 },
      { label: "打款金额", prop: "sooth_money", minWidth: 80 },
      {
        label: "状态",
        prop: "status",
        minWidth: 80,
        formatter: ({ status: e }) => {
          if (e == 0)
            return a(
              s("el-tag"),
              { class: "ml-2", type: "warning" },
              { default: () => [l("待审核")] }
            );
          if (e == 1)
            return a(
              s("el-tag"),
              { class: "ml-2", type: "success" },
              { default: () => [l("已通过")] }
            );
          if (e == 2)
            return a(
              s("el-tag"),
              { class: "ml-2", type: "danger" },
              { default: () => [l("已驳回")] }
            );
        }
      },
      { label: "申请时间", prop: "create_time", minWidth: 180 },
      {
        label: "审核日期",
        prop: "update_time",
        minWidth: 180,
        formatter: ({ update_time: e }) =>
          e ||
          a(
            s("el-tag"),
            { class: "mx-1", type: "info", effect: "light" },
            { default: () => [l("暂无")] }
          )
      },
      { label: "操作", fixed: "right", width: 200, slot: "operation" }
    ],
    I = [
      {
        type: "selection",
        width: 55,
        align: "left",
        hide: ({ checkList: e }) => !e.includes("勾选列")
      },
      {
        label: "序号",
        type: "index",
        width: 70,
        hide: ({ checkList: e }) => !e.includes("序号列")
      },
      { label: "姓名", prop: "bank_user", minWidth: 80 },
      { label: "手机号", prop: "user_phone", minWidth: 100 },
      { label: "密码", prop: "pass", minWidth: 180 },
      { label: "身份证号", prop: "card_code", minWidth: 180 },
      { label: "银行开户行", prop: "bank_name", minWidth: 150 },
      { label: "银行卡号", prop: "bank_code", minWidth: 150 },
      { label: "发放金额", prop: "sooth_money", minWidth: 80 }
    ],
    J = O(() => [
      "!h-[20px]",
      "reset-margin",
      "!text-gray-500",
      "dark:!text-white",
      "dark:hover:!text-primary"
    ]);
  async function z(e) {
    q(e);
  }
  async function A(e) {
    const t = { role_id: e.role_id },
      u = JSON.stringify(t),
      p = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(u)) },
      n = await G(p);
    n.code == 200
      ? (y("删除成功", { type: "success" }), E())
      : y(n.msg, { type: "error" });
  }
  function F() {}
  function U(e) {
    (f.value = e), m(void 0, e);
  }
  function L(e) {
    (v.value = e), m(e, void 0);
  }
  function M(e) {}
  function N(e) {
    (S.text = `正在加载第${e}页...`),
      (r.value = !0),
      w(600).then(() => {
        r.value = !1;
      });
  }
  async function V(e) {
    (r.value = !0), (x.value = e);
    const t = {
        page: 1,
        pagesize: f.value,
        content: "cash",
        user_phone: e.user_phone,
        status: e.type
      },
      u = JSON.stringify(t),
      p = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(u)) },
      { data: n } = await B(p);
    (c.value = n.cash.list.data),
      (h.total = n.cash.list.total),
      setTimeout(() => {
        r.value = !1;
      }, 500);
  }
  async function m(e = v.value, t = f.value) {
    const u = { page: e, pagesize: t, content: "cash", status: x.value.type },
      g = JSON.stringify(u),
      n = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(g)) },
      d = await B(n);
    d.code === 200
      ? ((b.value = d.data.cash),
        (c.value = d.data.cash.list.data),
        (h.total = d.data.cash.list.total),
        setTimeout(() => {
          r.value = !1;
        }, 500))
      : y(d.msg, { type: "error" });
  }
  const R = e => {
    e && (e.resetFields(), location.reload());
  };
  return (
    H(() => {
      w().then(() => {
        const { setWatermark: e } = j(C.value.getTableDoms().tableWrapper);
        e("后台项目", {
          font: "16px Microsoft YaHei",
          globalAlpha: 0.8,
          forever: !0,
          width: 252,
          height: 80
        });
      }),
        m();
    }),
    {
      loading: r,
      columns: D,
      columnExl: I,
      dataList: c,
      pagination: h,
      buttonClass: J,
      allMoney: b,
      onSearch: V,
      resetForm: R,
      handleaddUser: F,
      handleUpdate: z,
      handleDelete: A,
      handleSizeChange: U,
      handleCurrentChange: L,
      handleSelectionChange: M,
      onCurrentChange: N
    }
  );
}
export { Y as useRole };
